package com.bluesky.plum.uimodels.standard.components;

import com.bluesky.plum.richdomain.RichDomainField;
import com.bluesky.plum.uimodels.standard.FieldUIComponent;

/**
 * text box as a classical component, has it's model, such as maxLength and text.
 * That means without rich domain field or target UI component, it is
 * stand alone, testable.
 * 
 * @author HZ00260
 * 
 */
public class TextBox extends FieldUIComponent {
	protected Integer maxLength;
	private String text;

	public TextBox(RichDomainField field) {
		super(field);

		text = (String) field.value;
	}

	public String getText() {

		return text;

	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public Object getDomainFieldValue() {

		// get the value from the target UI component.

		return getText();

	}
	
	@Override
	public void setDomainFieldValue(Object value) {
		
		setText((String)value);
	}
}
